# Maintainer: Caleb Maclennan <caleb@alerque.com>
# Contributor: Stefan Husmann <stefan-husmann@t-online.de>
# Contributor: Pierre Chapuis <catwell at archlinux dot us>

pkgbase=lua-stdlib
_rockname=${pkgbase#lua-}
pkgname=("$pkgbase" "lua51-$_rockname" "lua52-$_rockname" "lua53-$_rockname")
pkgver=41.2.2
_rockrel=1
pkgrel=8
pkgdesc='Library of modules for common programming tasks'
arch=(any)
url="https://github.com/$pkgbase/$pkgbase"
license=(MIT)
makedepends=(lua
             lua51
             lua52
             lua53
             luarocks)
_archive="$pkgbase-release-v$pkgver"
source=("$_archive.tar.gz::$url/archive/release-v$pkgver.tar.gz")
sha256sums=('42ca25ddcde59f608694a3335d24919a4df4cf6f14ea46c75249561a16c84711')

_package() {
	cd "$_archive"
	depends=(${pkgname%-*})
	luarocks --lua-version="$1" --tree="$pkgdir/usr/" \
		make --deps-mode=none --no-manifest "$_rockname-$pkgver-$_rockrel.rockspec"
	install -Dm0644 -t "$pkgdir/usr/share/licenses/$pkgname/" COPYING
}

package_lua-stdlib() {
	_package 5.4
}

package_lua51-stdlib() {
	_package 5.1
}

package_lua52-stdlib() {
	_package 5.2
}

package_lua53-stdlib() {
	_package 5.3
}
